Event.getPhotographer   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
2
import { School } from '../School/School.entity';
3
import { User } from '../User/User.entity';
4
5
@Entity()
6
export class Event {
7
  @PrimaryGeneratedColumn('uuid')
8
  private id: string;
9
10
  @Column({ type: 'timestamp', nullable: false })
11
  private date: Date;
12
13
  @Column({ type: 'varchar', nullable: true })
14
  private summary: string;
15
16
  @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' })
17
  private school: School;
18
19
  @ManyToOne(() => User, { nullable: false, onDelete: 'CASCADE' })
20
  private photographer: User;
21
22
  constructor(
23
    date: Date,
24
    photographer: User,
25
    school: School,
26
    summary?: string
27
  ) {
28
    this.date = date;
29
    this.photographer = photographer;
30
    this.school = school;
31
    this.summary = summary;
32
  }
33
34
  public getId(): string {
35
    return this.id;
36
  }
37
38
  public getDate(): Date {
39
    return this.date;
40
  }
41
42
  public getSummary(): string | null {
43
    return this.summary;
44
  }
45
46
  public getSchool(): School | null {
47
    return this.school;
48
  }
49
50
  public getPhotographer(): User | null {
51
    return this.photographer;
52
  }
53
54
  public update(
55
    date: Date,
56
    photographer: User,
57
    school: School,
58
    summary?: string
59
  ): void {
60
    this.date = date;
61
    this.photographer = photographer;
62
    this.school = school;
63
    this.summary = summary;
64
  }
65
}
66